#
# This is the directory where the sources are located
# You'll have to edit this to match your own tree
#
SOURCE_DIR:=/home/projects/common

#
# This is the directory where libraries and binaries are located
# You'll have to edit this to match your own tree
#
TARGET_DIR:=../../../runimage/linux_x86


#
# Here's the compiler command line
#
CFLAGS += -Wall -I $(SOURCE_DIR)

#
# Here's the linker command line
#
LDFLAGS += -L$(TARGET_DIR)
LDLIBS  += -lspringprox

# libftdi (-lftdi) is required is SpringProx library has been compiled with USB support

#CCFLAGS+=/D _DEBUG


all:\
	$(TARGET_DIR)/ref_find \
	$(TARGET_DIR)/ref_wait \
	$(TARGET_DIR)/ref_find_old \
	$(TARGET_DIR)/ref_mifare \
	$(TARGET_DIR)/ref_mif_ul \
	$(TARGET_DIR)/ref_mif_ulc \
	$(TARGET_DIR)/ref_askcts256b \
	$(TARGET_DIR)/ref_askcts512b \
	$(TARGET_DIR)/ref_stsr176 \
	$(TARGET_DIR)/ref_icode1 \
	$(TARGET_DIR)/ref_15693 \
	$(TARGET_DIR)/ref_desfire \
	$(TARGET_DIR)/ref_calypso

clean:
	rm -f *.o

$(TARGET_DIR)/ref_find: ref_find.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_wait: ref_wait.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_find_old: ref_find_old.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_mifare: ref_mifare.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_mif_ul: ref_mif_ul.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_askcts256b: ref_askcts256b.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_askcts512b: ref_askcts512b.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_stsr176: ref_stsr176.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_icode1: ref_icode1.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_15693: ref_15693.o
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(TARGET_DIR)/ref_desfire: ref_desfire.o
	$(CC) $(LDFLAGS) $^ -lsprox_desfire $(LDLIBS) -o $@

$(TARGET_DIR)/ref_mif_ulc: ref_mif_ulc.o
	$(CC) $(LDFLAGS) $^ -lsprox_mifulc $(LDLIBS) -o $@

$(TARGET_DIR)/ref_calypso: ref_calypso.o
	$(CC) $(LDFLAGS) $^ -lsprox_calypso $(LDLIBS) -o $@

%.o: ../%.c
	$(CC) $(CFLAGS) -c -o $@ $<
